package thread2;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class future2 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> futureTask = new FutureTask<>(()->{

            Thread.sleep(3000);
            System.out.println(Thread.currentThread().getName());
            return 12;
        });
        new Thread(futureTask).start();
        System.out.println( futureTask.get());
    }
}
